package com.blue.gateway.client.anno;

import com.blue.gateway.client.strategy.AbstractStrategyGetLoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

/**
 * 注解处理器加入到参数解析器
 *
 * @author liulei
 * @version 1.0
 */
@Slf4j
@Configuration
public class ParameterResolverConfig implements WebMvcConfigurer {

    @Autowired
    private List<AbstractStrategyGetLoginUser> strategyGetLoginUsers;

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
        log.info("网关授权客户端添加解析器");
        resolvers.add(new LoginUserResolver(strategyGetLoginUsers));
    }
}

